﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;



namespace NavigatorAdd
{
    public static class AddNavigatorOperation
    {
        public static void SetDestinationToSelf(this NavMeshAgent navigator)
        {
            var selfPos = navigator.transform.position;
            navigator.SetDestination(selfPos);
        }

        public static bool DoseStopPointInRange(this NavMeshAgent navigator,float range)
        {
            var target = navigator.destination;
            var self = navigator.transform.position;

            target.y= self.y;

            var distance = Vector3.Distance(target,self);

            return distance<range;
        }
    }
}
